﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using UnityEngine;



public class GunScript : MonoBehaviour
{
    public GameObject bullet;
    public GameObject aim;

    public void Shoot(MoveDirection direction)
    {
        Vector3 dir;
        if (direction == MoveDirection.Right)
            dir = Vector3.right;
        else
            dir = Vector3.left;

        //Vector3 dir = aim.transform.position;

        GameObject bulletInstance = Instantiate(bullet, transform.position, transform.rotation) as GameObject;
        bulletInstance.rigidbody.AddForce(dir * 20, ForceMode.Impulse);
    }
}

